var closer;
var containerElement;
var overlay;
var content
function Lightbox(pCloser,pOverLay,pContainerElement,pContent){
   
    closer=pCloser;
    containerElement=pContainerElement;
    overlay=pOverLay;
    content=pContent;
    var obj=this;
    //    this.addEvent("click", pCloser, function(e){
    //        obj.hide();
    //    });
    //     this.addEvent("click", pContainerElement, function(e){
    //         if (obj.onContainerClick && typeof(obj.onContainerClick) === "function") {
    //        obj.onContainerClick(e);
    //    }
    //    });
    closer.onclick=function(e){
        obj.hide();
    }
    containerElement.onclick=function(e){
        if (obj.onContainerClick && typeof(obj.onContainerClick) === "function") {
            obj.onContainerClick(e);
        }

    }
    Lightbox.prototype.initSave=function(btnSave){
        var obj=this;
        btnSave.onclick=function(e){
            if (obj.onSave && typeof(obj.onSave) === "function") {
                obj.onSave(e);
            }
        }
    }
}
Lightbox.prototype.onSave;

Lightbox.prototype.onContainerClick;
Lightbox.prototype.removeEventHandler=function(eventType,elem,functionName) {
    if (elem.removeEventListener) 
        elem.removeEventListener (eventType,functionName,false);
    if (elem.detachEvent)
        elem.detachEvent ('on'+eventType,functionName); 
}
Lightbox.prototype.addEvent=function(eventType,element, functionName){
    if (element.addEventListener) {
        element.addEventListener(eventType, functionName, false);
        return true;
    }
    else if (element.attachEvent){
        var r = element.attachEvent('on' + eventType, functionName);
        return r;
    }
    else {
        element['on' + eventType] = functionName;
    }
};
Lightbox.prototype.show=function(){
    if(containerElement){
        containerElement.style.display='block';
    }
    if(overlay){
        overlay.style.display='block';
    }
}
Lightbox.prototype.hide=function(){
    if(containerElement){
        containerElement.style.display='none';
    }
    if(overlay){
        overlay.style.display='none';
    }
}